package com.jy.wms.web;

import com.jy.wms.common.base.BaseController;
import com.jy.wms.common.base.BaseSessionInfo;
import com.jy.wms.pojo.SysHz;
import com.jy.wms.pojo.WmsLibraryPosition;
import com.jy.wms.service.SysMenuService;
import com.jy.wms.service.WmsLibraryPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/supplier")
public class WmsSupplierRouter extends BaseController<WmsLibraryPositionService,WmsLibraryPosition> {
    @Autowired
    SysMenuService menuService;
    //供应商页面
    @RequestMapping(value = "/supplier/{menu}")
    public  String  tosupplier(@PathVariable("menu") String menu, Model model){
        model.addAttribute("functions",menuService.getFunctions(menu));
        return "business/wmsSupplier/supplier";
    }
    //添加供应商
    @RequestMapping(value = "/addsupplier")
    public  String addsupplier(Model model, HttpSession session){
        List<SysHz> hz= (List<SysHz>) session.getAttribute(BaseSessionInfo.SessionConsignor);//货主信息
        if(hz.size()>0){
            model.addAttribute("sshzid",hz.get(0).getShow_hzid());
        }
        return "business/wmsSupplier/addsupplier";
    }
}
